/**
 * @author   Ivan Andonov
 * @email:   ivan.andonov[at]gmail[dot]com
 *
 * @require  sjs 
 * @use  
 * @optional 
 **/

(function() {
	
	sjs.create('sjs.Objects', {
		
		// PUBLIC STATIC METHODS
		each : function(obj, method, target) {
			if (typeof(obj) == 'object') {
				for (var prop in obj) {
					if (typeof(obj[prop]) != 'function') {
						var result = method.apply(target || obj, [prop, obj[prop], obj]);
						if (result !== null && result !== undefined) {
							return result;
						}
					}
				}
			}
		},
		
		copy : function(fromObj, toObj, includeMethods) {
			if (!toObj) {
				toObj = {};
			}
			for (var prop in fromObj) {
				if (includeMethods || typeof(fromObj[prop]) != 'function') {
					toObj[prop] = fromObj[prop];
				}
			}
			return toObj;
		}
		
	});
	
})();